package jp.co.systemi.asp.workflow.validator;

import org.apache.wicket.validation.INullAcceptingValidator;
import org.apache.wicket.validation.IValidatable;
import org.apache.wicket.validation.validator.AbstractValidator;
import org.datanucleus.util.StringUtils;

public class RequiredValidator extends AbstractValidator<String> implements
        INullAcceptingValidator<String> {
    private static final long serialVersionUID = 2771534562628319288L;

    @Override
    protected void onValidate(IValidatable<String> arg0) {
        if (StringUtils.isEmpty(arg0.getValue())) {
            error(arg0);
        }
    }

    public boolean validateOnNullValue() {
        return true;
    }
    // resourceKeyはデフォルトRequiredValidator
}
